package soccerscope.model;

import java.io.Serializable;

import robocup.component.tactics.AbstractState.STATES;
import robocup.component.worldobjects.Player;
import soccerscope.util.geom.Point2f;

/**
 * @author Andr�
 * 
 * the simple player object a simple player has speed and position
 * 
 */
public class SimplePlayer
    implements Serializable {

  public SimplePlayer() {

  }

  /**
   * creates a new SimplePlayer and copy all data from specified player in the
   * new object.
   * 
   * @param player
   *          the player with the original data
   * @param incorrectCoodinates
   *          is the coordinate system not correct?
   */
  public SimplePlayer(
      Player player,
      boolean incorrectCoodinates) {

    this.copy(player, incorrectCoodinates);
  }

  /**
   * Copies data of a specified player to this object.
   * 
   * @param player
   *          the player with the original data
   * @param incorrectCoodinates
   *          is the coordinate system not correct?
   */
  public void copy(Player player,
      boolean incorrectCoodinates) {

    double correction = 1.0;
    if (incorrectCoodinates) {
      correction = -1.0;
    }
    this.isGoalie = player.isGoalie();
    this.positionX = player.getPosition().x * correction;
    this.positionY = player.getPosition().y * correction;
    this.speedX = player.getSpeed().x * correction;
    this.speedY = player.getSpeed().y * correction;
    this.positionIsReliable = player.isReliable();
    this.simpleBody = player.getBodyDir();
    this.lastState = player.getLastState();
    this.roleNumber = player.getRoleNumber();
  }

  private static final long serialVersionUID     = 5112799571089893327L;

  public double             positionX            = -9999;

  public double             positionY            = -9999;

  public boolean            positionIsReliable   = true;

  public boolean            isGoalie             = false;

  public double             simpleBody           = 0;

  public double             speedX               = -9999;

  public double             speedY               = -9999;

  public int                ballInterceptionTime = -1;

  public int                stamina              = 4000;

  public int                playerType           = 0;

  public STATES             lastState            = STATES.DUMMY_STATE;

  public int                roleNumber           = -1;

  public Point2f            bestPos              = null;
}
